package com.example.demo.services;


import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;


// 这是一个服务，用来发送消息到RabbitMQ队列
@Service
public class RabbitMQService {


    private final RabbitTemplate rabbitTemplate;

    public RabbitMQService(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    public void sendMessage(String message) {
        rabbitTemplate.convertAndSend("my-snow-exchange", "routingKey", message);
    }



}
